<?php
declare (strict_types = 1);

namespace app\service;

use app\common\library\Wechat;

class WechatService extends \think\Service
{
    /**
     * 注册服务
     *
     * @return mixed
     */
    public function register()
    {
    	//
        //手动修改的
        // 将绑定标识到对应的类
         $this->app->bind('wechat_service', Wechat::class);
    }

    /**
     * 执行服务
     *
     * @return mixed
     */
    public function boot()
    {
        //
        //手动修改的
        //echo 'wechatService-boot()';
        $config = [
            'app_id' => config("wechat.app_id"),
            'secret' => config("wechat.secret"),
            'token' => config("wechat.token"),
            'aes_key' => config("wechat.aes_key"),

            // 指定 API 调用返回结果的类型：array(default)/collection/object/raw/自定义类名
            'response_type' => config("response_type"),

            //...
        ];
        Wechat::init_wechatapp($config);
    }
}
